package code.example.hystrix.test.impl;

import code.example.tool.LogFactory;
import com.netflix.hystrix.HystrixCommand;

public class HystrixCommandVisitHttpBlockingCall {

    public void blockingCall(HystrixCommand<String> hystrixCommand ){
        try {
            String result = hystrixCommand.execute();
            LogFactory.getLog().info(Thread.currentThread().getName() + ": run finish, result=" + result);
        }catch (Exception e){
            LogFactory.getLog().info(Thread.currentThread().getName() + ": run error");
            LogFactory.getLog().error(e);
        }
    }
    public static void main(String [] args){
        HystrixCommandVisitHttp hystrixCommandVisitHttp = new HystrixCommandVisitHttp();
        new HystrixCommandVisitHttpBlockingCall().blockingCall(hystrixCommandVisitHttp);
    }
}
